#include <iostream>
#include <Eigen/Dense>
#include <cfloat>

using namespace Eigen;
using namespace std;

int main()
{
    MatrixXd m = MatrixXd::Random(3, 3);
    m = (m + MatrixXd::Constant(3, 3, 1.2)) * 50;
    cout << "m =" << endl
         << m << endl;
    m.transposeInPlace();
    cout << "m =" << endl
         << m << endl;
    VectorXd v(3);
    v << 1, 2, 3;
    cout << "3 * v =" << endl
         << 3 * v << endl;
    VectorXd vv = VectorXd::Constant(4, DBL_MAX);
    vv[2] = 3.1415926;
    cout << vv << endl;

    typedef Matrix<double, Dynamic, Dynamic,RowMajor>rMatrixXd;
    typedef Matrix<double, 1, Dynamic, RowMajor> rVectorXd;
    double da[6];
    for (int i = 0; i < 6; i++)
        da[i] = i;
    Map<rMatrixXd> e_da1(da, 2, 3);
//     rMatrixXd e_da1 = rMatrixXd::Map(da, 2, 3);
    cout << e_da1 << endl;
    cout << e_da1.block(0, 1, 2, 1) << endl;
    cout << e_da1.transpose() * e_da1 << endl;
    cout << da << endl;
    cout << e_da1.data() << endl;
//     for(int i=0; i<6; i++) cout << da[i] << " ";
//     cout << endl;

//     cout << rVectorXd::Ones(2) << endl;
//     cout << rMatrixXd::Ones(2, 3) << endl;
//     cout << m.array().square() << endl;
//     cout << rMatrixXd::Constant(2, 3, 1.5) << endl;
}